<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\ckeditor\CKEditor;
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;
use app\common\widgets\MyFileUpload;

/* @var $this yii\web\View */
/* @var $model app\models\GkyWeArticle */
/* @var $form yii\widgets\ActiveForm */
?>

<script type="text/javascript" src="js/qiniuupload/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/qiniuupload/plupload/plupload.full.min.js"></script>
<script type="text/javascript" src="js/qiniuupload/plupload/i18n/zh_CN.js"></script>
<script type="text/javascript" src="js/qiniuupload/ui.js"></script>
<script type="text/javascript" src="js/qiniuupload/qiniu.js"></script>
<script type="text/javascript" src="js/qiniuupload/highlight/highlight.js"></script>
<script type="text/javascript" src="js/qiniuupload/main.js"></script>

<div class="gky-we-article-form">
    <div class="panel panel-default">
        <!--<div class="panel-heading text-center" style="background: #003eff;color:white">gky-we-article</div>-->
        <div class="panel-body">
            <?php
            $form = ActiveForm::begin([
                        'options' => ['class' => 'form-horizontal form-group'],
                        'fieldConfig' => [
                            'template' => "{label}<div class=\"col-lg-10\">{input}</div>",
                            'labelOptions' => ['class' => 'col-lg-2 control-label'],
                        ]
            ]);
            ?>

            <div class="col-lg-12 col-xs-12 col-sm-12 col-md-12">
                <?php // echo $form->field($model, 'weid')->textInput() ?>
                <?php
                $data = \app\models\GkyWeAccount::find()->all();
                echo $form->field($model, 'weid')->dropDownList(
                        \yii\helpers\ArrayHelper::map($data, 'id', 'wename'))->label('微信订阅号');
                ?>
            </div>
<!--            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                <?php // echo $form->field($model, 'wename')->textInput(['maxlength' => true]) ?>
            </div>-->
<!--            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                <?php // echo $form->field($model, 'addtime')->textInput() ?>
            </div>-->

            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                <?= $form->field($model, 'puber')->textInput(['maxlength' => true]) ?>
            </div>
            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
            </div>
            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                <?php // echo $form->field($model, 'arttype')->textInput(['maxlength' => true]) ?>
                <?php
                $data = app\models\GkyWeArticleType::find()->all();
                echo $form->field($model, 'typeid')->widget(Select2::classname(), [
                    'data' => ArrayHelper::map($data,'id','typename'),
                    'options' => ['placeholder' => '请输入类型'],
                    'pluginOptions' => [
                        'allowClear' => true
                    ],
                ])->label('文章类型');
                ?>
            </div>

            <div class="col-lg-12 col-xs-12 col-sm-12 col-md-12">
                <?php //$form->field($model, 'content')->textarea(['rows' => 6]) ?>

                <?php
                echo $form->field($model, 'content')->widget(CKEditor::className(), ['preset' => 'advanced'])
                ?>

            </div>
            
            <div class="col-lg-12 col-xs-12 col-sm-12 col-md-12">
                <?php // echo $form->field($model, 'banner')->textInput(['maxlength' => true]) ?>
                <?php 
                    if($model->banner){
                        echo "<font style='color:#333; font-size:14px; font-weight:bolder;'>横幅</font>";
                        echo Html::img($model->banner,[]);
                    }
                ?>
             <?= MyFileUpload::widget() ?>
            </div>
            
            
            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                <?php // echo $form->field($model, 'olink')->textInput(['maxlength' => true]) ?>
            </div>
            <div class="form-group col-lg-12 col-xs-12 col-sm-12 col-md-12">
                <?= Html::submitButton('保存', ['class' => 'btn btn-success col-lg-offset-5 col-xs-offset-5 col-sm-offset-5 col-md-offset-5']) ?>
                <?= Html::a('返回', ['index'], ['class' => 'btn btn-primary']) ?>
            </div>

            <?php ActiveForm::end(); ?>
        </div>
    </div>

</div>
